package com.example.common.utils;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class R {

    private int code;
    private String msg;
    private Object data;

    public static R success(String msg) {
        return new R(200, msg, null);
    }

    public static R success(Object data) {
        return new R(200, null, data);
    }

    public static R success(String msg, Object data) {
        return new R(200, msg, data);
    }

    public static R error(String msg) {
        return new R(300, msg, null);
    }

    public static R sysError(String msg) {
        return new R(500, msg, null);
    }
}